package filereaders;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import dataset.DataPoint;
import dataset.DataSet;

public class Factory {

    public DataSet createDataSet (File file) {
        // choose which parser (txt or xml)
        
        // for txt file, each line becomes DataPoint
        // for xml file, each <stock> tag and sub-tags become DataPoint
        
        // put each DataPoint into DataSet and return full set
        
        
        // Dummy Data for testing (removed once parsers are working correctly)
        Map<String, Double> data = new HashMap<String,Double>();
        data.put("Date", 1.0);
        data.put("Open", 2.0);
        data.put("Close", 3.0);
        DataPoint point = new DataPoint(data);
        point.changeYoption("Close");
        
        Map<String, Double> data2 = new HashMap<String,Double>();
        data2.put("Date", 4.0);
        data2.put("Open", 5.0);
        data2.put("Close", 6.0);
        DataPoint point2 = new DataPoint(data2);
        
        Collection<DataPoint> points = new ArrayList<DataPoint>();
        points.add(point);
        points.add(point2);
        
        DataSet set = new DataSet(points, "Here's the Title");
        
        return set;
    }

}
